﻿using Castle.DynamicProxy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace DapperCore.AOP
{
    public class LogInterceptor: IInterceptor
    {
        public void Intercept(IInvocation invocation)
        {
            try
            {
                invocation.Proceed();
                Dapper.Logger.LogHelper.logger.Info(invocation.Method.Name);
            }
            catch (Exception ex)
            {
                Dapper.Logger.LogHelper.logger.Error(invocation.Method.Name+ " " + ex.ToString()); 
            }
        }
    }
}
